<?php
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );

class Streetmain extends CI_Controller {
	
	function __construct() {
		parent::__construct ();
	
	}
	
	public function index() {
		$eData = array();
//		轮播图		
		$this->db->order_by ( 'sort', 'asc' );
		$this->db->order_by ( 'id', 'desc' );
		$this->db->where ( 'cid', 2 );
		$eData['lunboList'] = $this->db->get ('adv',4,0)->result_array ();
		
		//分类
		$this->db->select("id,name");
		$this->db->where('area',1);//黄埔
		$eData['huangpulist'] = $this->db->get ('street')->result_array ();
		
		$this->db->select("id,name");
		$this->db->where('area',2);//卢湾区
		$eData['luwanlist'] = $this->db->get ('street')->result_array ();
		
		$this->db->select("id,name");
		$this->db->where('area',3);//静安区
		$eData['jinganlist'] = $this->db->get ('street')->result_array ();
		
		$this->db->select("id,name");
		$this->db->where('area',4);//徐汇区
		$eData['xuhuilist'] = $this->db->get ('street')->result_array ();
		
		$this->db->select("id,name");
		$this->db->where('area',5);//虹口区
		$eData['hongkoulist'] = $this->db->get ('street')->result_array ();
		
		$this->db->select("id,name");
		$this->db->where('area',6);//浦东新区
		$eData['pudonglist'] = $this->db->get ('street')->result_array ();
		
		//明星街道
		$this->db->where('isstar',1);
		$this->db->limit(2);
		$startmp = $this->db->get('street')->result_array();
		$startstreet = array();
		$i = 0;
		foreach ($startmp as $key=>$street){
			$this->db->where('street',$street['id']);
			$this->db->limit(5,0);
			$street['storeList'] = $this->db->get ('store')->result_array ();
			$this->db->where('name','area');
			$this->db->where('code',$street['area']);
			$street['areaname'] = $this->db->get('codevalue')->row_array();
			$startstreet[$i] = $street;
			$i++;
		}
		$eData['starstreet'] = $startstreet;
		
		//热门街道话题
		$this->db->select("topic.*,street.id as streetid,street.name as streetname");
		$this->db->from("topic");
		$this->db->join('street','street.id=topic.belongId');
		$this->db->where('street.isstar',1);
		$this->db->where('type',1);
		$this->db->limit(6,0);
		$eData['hottopic'] = $this->db->get()->result_array ();
		
		$this->load->view ( 'streetmain', $eData );
	}
	
	
	
}

